package com.sky.com.sky.web.app;

import com.sky.dto.CategoryDTO;
import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//指定名称,否则回合后台管理的categoryController同名冲突
@RestController("userCategoryController")
@RequestMapping("/user/category")
public class CategoryController {
    @Autowired
    CategoryService categoryService;

    /**
     * 查询菜品+套餐分类列表
     * @return
     * **/
    @GetMapping("/list")
    public Result list(){
        //设置查询条件
        CategoryDTO categoryDTO = CategoryDTO.builder()
                .status(1).build();
        //条件查询
        List<Category> categoryList = categoryService.list(categoryDTO);
        //返回结果
        return Result.success(categoryList);
    }





}
